package com.example.leetcode.graph;

import com.example.leetcode.array.common.ArrayUtils;
import com.example.leetcode.graph.common.GraphUtils;

import java.util.List;

class Solution841 {
    public boolean canVisitAllRooms(List<List<Integer>> rooms) {
//        return GraphUtils.canVisitAllRooms(rooms);
        return GraphUtils.canVisitAllRooms2(rooms);
    }
}

public class leetcode841 {
    public static void main(String[] args) {
        Solution841 solution841 = new Solution841();
        int[][] rooms = {{1}, {2}, {3}, {}};
        int[][] rooms1 = {{1, 3}, {3, 0, 1}, {2}, {0}};
        test841(solution841, rooms);
        test841(solution841, rooms1);
    }

    private static void test841(Solution841 solution841, int[][] nums) {
        List<List<Integer>> rooms = ArrayUtils.convertArrayToList(nums);
        System.out.println(solution841.canVisitAllRooms(rooms));
    }
}
